package com.sq.partner.manager.dao.impl;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.sq.partner.manager.dao.ArtirationCardDao;
import com.sq.partner.manager.mybatis.model.ActirationCardDifinition;
import com.sq.partner.manager.util.Page;


@Repository
public class ArtirationCardDaoImpl extends BaseDaoImpl implements ArtirationCardDao {
	@Override
	public Integer getTotalActirationCardDifinition(Map<String, Object> map)
			throws Exception {
		return (Integer) this.query("queryActirationCardDifinitionCount", map);
	}

	@SuppressWarnings("unchecked")
	@Override
	public Page<ActirationCardDifinition> queryPage(Page<ActirationCardDifinition> page) throws Exception{
		Integer i= getTotalActirationCardDifinition(page.getMap());
		page.setTotal(i);
		List<ActirationCardDifinition> sales=(List<ActirationCardDifinition>)this.queryList("queryActirationCardDifinition", page.getMap());
		page.setData(sales);
		return page;
	}
	@Override
	public ActirationCardDifinition query(ActirationCardDifinition carinfo) throws Exception{
		return (ActirationCardDifinition) this.query("queryActirationCardDifinitionOne", carinfo);
	}
	@Override
	public boolean insert(ActirationCardDifinition carinfo) throws Exception{
		return this.add("insertActirationCardDifinition", carinfo);
	}
	@Override
	public boolean update(ActirationCardDifinition carinfo) throws Exception{
		return this.update("updateActirationCardDifinition", carinfo);
	}
	@Override
	public boolean delete(String carinfo) throws Exception{
		return this.delete("deleteActirationCardDifinition", carinfo);
	}
	@Override
	public Integer queryNameCount(String name) throws Exception{
		return (Integer)this.query("queryNameCount", name);
	}

	@Override
	public String queryPlanName(ActirationCardDifinition carinfo)
			throws Exception {
		
		return (String) this.query("queryPlanName", carinfo);
	}
	@Override
	public BigDecimal queryAllpremium(String planNo) throws Exception{
	    return (BigDecimal)this.query("queryPlanAllamount",planNo);
	}
}
